#ifndef NODE_H_
#define NODE_H_
template<class T>
class Node
{
public:
	T data;
	Node(const T& data,Node<T>* n=nullptr):data(data),next(n){}
	Node() :Node(0, nullptr){}
	void insertAfter(Node<T>* p);
	Node<T>* deleteAfter();
	Node<T>* nextNode();
	const Node<T>* nextNode() const;
	Node<T>* next;
	T getData();

};
template <class T>
void Node<T>::insertAfter(Node<T>* p)
{
	p->next = next;
	next = p;
}

template <class T>
Node<T>* Node<T>::deleteAfter()
{
	Node<T>* temp = next;
	if (next==nullptr)
	{
		return nullptr;
	}
	else
	{
		next = temp->next;
	}
	return temp;
}
template <class T>
Node<T>* Node<T>::nextNode()
{
	return next;
}
template <class T>
const Node<T>* Node<T>::nextNode() const
{
	return next;
}

template <class T>
T Node<T>::getData()
{
	return  data;
}

#endif

